package com.fwmagic.spark.core.cases.globalsort

class Boy(val name: String, val age: Int, val faceValue: Double) extends Ordered[Boy] with Serializable {
    override def compare(that: Boy): Int = {
        if (this.faceValue == that.faceValue) {
            //升序
            this.age - that.age
        } else {
            //降序
            -(this.faceValue - that.faceValue).toInt
        }
    }

    override def toString: String = s"Boy($name,$age,$faceValue)"
}
